package com.android.kmlmrg.services.receivers;

import com.android.kmlmrg.R;
import com.android.kmlmrg.model.User;
import com.android.kmlmrg.services.ServiceController;
import com.android.kmlmrg.services.rest.method.UpdateUserPhoto;
import com.android.kmlmrg.utils.MethodeFile;
import com.android.kmlmrg.views.DashBoard;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.util.Log;
import android.widget.Toast;

public class FormAuthenticationIntentReceiver extends BroadcastReceiver {

	/**LOG**/
	private static final  String LOG_TAG = FormAuthenticationIntentReceiver.class.getName();

	public static final String LOGIN_OK="LOGIN_OK";

	public static final String LOGIN_FAILED="LOGIN_FAILED";

	@Override
	public void onReceive(Context context, Intent pIntent) {
		Log.i(LOG_TAG, "START - onReceive(Context context, Intent intent)");

		
		
		Log.i(LOG_TAG, "ACTION  : " + pIntent.getAction());

		if ( pIntent.getAction().equalsIgnoreCase(LOGIN_OK) ) {
			Toast.makeText(context,  pIntent.getAction(), Toast.LENGTH_SHORT).show();
			Intent vIntent = new Intent(context, DashBoard.class);
			vIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
			context.startActivity(vIntent);
		} else if (pIntent.getAction().equalsIgnoreCase(LOGIN_FAILED) ) {
			Toast.makeText(context,  pIntent.getAction(), Toast.LENGTH_SHORT).show();
		} 
		Log.i(LOG_TAG, "END - onReceive(Context context, Intent intent)");
	}

}
